from socket import *

HOST = '127.0.0.1'
PORT = 21567
BUFSIZ = 1024
ADDR = (HOST,PORT)

tcpClient = socket(AF_INET,SOCK_STREAM)
tcpClient.connect(ADDR)

while True:
    data = input('> ')
    if not data:
        break
    tcpClient.send(data.encode())
    data = tcpClient.recv(BUFSIZ)
    if not data:
        break
    print(data.decode('utf-8'))
tcpClient.close()